package com.itheima.mString;

import java.util.Scanner;

/*
   需求:键盘录入一个字符串,如果字符串中包含(TMD),则使用***替换
 */
public class StringDemo05 {
    public static void main(String[] args) {
        //1.键盘录入一个字符串
        Scanner sc = new Scanner(System.in);
        System.out.println("请录入:");
        String words = sc.nextLine();
        //2.替换敏感词
        //words = words.replace("TMD", "***");
        //System.out.println(words);
        String[] mgc = {"TMD","sb","SB","tmd"};
        for (int i = 0; i < mgc.length; i++) {
            words = words.replace(mgc[i],"***");
        }
        System.out.println(words);
    }
}
